package com.lp.module_home_b.activity;

import android.os.Bundle;

import com.lp.module_home_b.R;
import com.lp.module_home_b.R2;
import com.lp.module_home_b.view.FlashChargeView;
import com.lp.module_lib.api.BasePresenter;
import com.lp.module_lib.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * 作者：created by LP_TREAM on 2020/11/25 22:28
 * 邮箱：806875201@qq.com
 */
public class HomeBActivity extends BaseActivity {

    @BindView(R2.id.chargeView)
    FlashChargeView mChargeView;

    private int mNumber = 0;

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.home_b_activity_home;
    }

    @Override
    protected void initData() {

        mChargeView.startChargeAnimator();
        start();
    }

    private void start() {
        postDelayed(new Runnable() {
            @Override
            public void run() {
                mNumber++;
                if (mNumber > 100) {
                    mNumber = 0;
                }
                mChargeView.setPower(mNumber);
                start();
            }
        }, 1000);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
